<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>组件</title>
  </head>
  <body>
    <div class="" id="app">
      <my-component></my-component>
    </div>
    <script src="js/jquery-1.8.3.min.js" charset="utf-8"></script>
    <script src="js/vue.js" charset="utf-8"></script>
    <script type="text/javascript">
        /* 定义组件 */
        var myComponent = Vue.extend({
          template: '<div>A custom component!</div>'
        })

        /* 注册组件  */
        Vue.component('my-component',myComponent)

        /* 创建实例 */
        var vm;
        $(function() {
          vm = new Vue({
            el:'#app'
          })
        })
    </script>
  </body>
</html>
